package main

import (
	"fmt"
	"google.golang.org/grpc"
	"log"
	"net"
	"study01/pb"
	"study01/service"
)

func main() {
	server := grpc.NewServer()
	pb.RegisterProductServiceServer(server, service.ProductService)
	listen, err := net.Listen("tcp", ":8002")
	if err != nil {
		log.Fatal("启动监听报错", err)
	}
	err = server.Serve(listen)
	if err != nil {
		log.Fatal("启动服务器出错", err)
	} else {
		fmt.Println("启动grpc服务端成功")
	}

}